#{extends 'main.html' /}
#{set title:'订单列表' /}
<script type="text/javascript" src="/public/sui/js/lrz.all.bundle.js"></script>
<script type="text/javascript" src="/public/sui/js/uploadImg.js"></script>
<script type="text/javascript" src="/public/sui/js/qrcode.min.js"></script>
<script type="text/javascript" src="/public/sui/js/list.js"></script>
<body>
<div class="page-group">
    <div class="page">
        <header class="bar bar-nav">
            <a href="javascript:history.go(-1);" class="icon icon-left pull-left"></a>

            <h1 class="title">个人中心</h1>
        </header>
        <section class="shop_info content scroll_y">
            <div class="list-block">
                <form name="form1" method="post" action="">
                    <input id="id_merchantId" value="${webUser.id}" type="hidden">
                    <ul>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">用户昵称：</div>
                                    <div class="item-input">
                                        <input id="id_name" type="text" name="name" value="${webUser.nickName}"
                                               placeholder="请输入">
                                    </div>
                                </div>
                            </div>
                        </li>

                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">手机号：</div>
                                    <div class="item-input">
                                        <input id="phone" type="text" name="phone"  value="${webUser.phone}" placeholder="请输入">
                                    </div>
                                </div>
                            </div>
                        </li>

                    </ul>
                    <div class="content-block">
                        <input type="button" name="button" class="button button-fill button-pink"
                               onclick="saveUser()" value="保存">
                    </div>

                </form>
            </div>

        </section>

    #{include 'footer.html'/}
    </div>
</div>
<script>
    $.init();
</script>
<script>
    function saveUser(){
        var phone = $("#phone").val();
        var name = $("#id_name").val();
        if(name == null || name == ''){
            $.toast('请填写用户昵称!');
            return ;
        }

        if(phone == null || phone == ''){
            $.toast('请填写用户手机号!');
            return ;
        }
        $.getJSON('/user/userPhone',{ phone:phone,name:name},function (data) {
            console.log(data);
            console.log("data.success",data.success);
            if(data.success){
                $.toast('保存成功')
            }else {

                $.toast('手机号已存在!');
            }
        })
    }

</script>
</body>
